#ifndef DW_SYSTEM_PROFILER_H
#	define DW_SYSTEM_PROFILER_H

#include "base/singleton.h"

#include "system/timer.h"

namespace dw {
	namespace system {
	
class Profile;

class Profiler
:	public dw::base::Singleton< Profiler >
{
public : //! @name Commands
	//! @{
	inline void BeginProfile(const std::string& profile);
	inline void EndProfile(const std::string& profile);
	inline void Enable();
	inline void Disable();
	inline void Toggle();
	std::string ToString();
	//! @}

protected : //! @name Construction & destruction
	//! @{
	inline Profiler();
	//! @}

protected : //! @name Friends
	//! @{
	friend class dw::base::Singleton< Profiler >;
	//! @}

private : //! @name Types definitions
	//! @{
	typedef std::map< std::string, Profile* >	ProfileMap;
	typedef ProfileMap::iterator ProfileIterator;
	//! @}

private : //! @name Data
	//! @{
	ProfileMap _profiles;
	ProfileIterator _currentProfile;
	Timer _timer;
	bool _isEnabled;
	std::string _header;
//! @}
};

	} // namespace system
} // namespace dw

#include "system/profiler.inl"

#endif // !DW_SYSTEM_PROFILER_H
